package com.lbmb.photodrawaimanager.controller;

import com.lbmb.photodrawaimanager.service.ImgOperationService;
import com.lbmb.photodrawaimanager.utils.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * @author hanWang
 * @Title:
 * @Package
 * @Description:  图片操作Controller
 * @date 2023/8/62:06 上午
 */
@RestController
@Controller("/api/v1/img/operation")
public class ImgOperationController {


    @Autowired
    ImgOperationService imgOperationService;


    /**
     * 人像漫画风 先将用户的数据上传预存一条数据库的数据 然后异步操作 去生成漫画图片 后根据数据ID 更新Base64 的数据
     */
    @RequestMapping("/manga_style")
    public Response<Long> mangaStyle(@RequestPart("source_id") Long sourceId, @RequestPart(value = "userImg", required = true) MultipartFile fil){
        /**
         *  获取用户上传的图片（待转换的图片 并且 保存 base64 数据到 数据库）
         */
        Long id = imgOperationService.mangaStyle(fil,sourceId);

        return null;

    }



}
